#ifndef _GIMBAL_TASK
#define _GIMBAL_TASK

#include "pid.h"
#include "bsp_can.h"
/*--define--begin--*/
#define RADAR_KEEP    0x02
#define FOLLOW_RADAR  0x01
#define FOLLOW_GIMBAL 0x00
/*--define--end--*/
/*******/
/*******/
/*--base--begin--*/
typedef struct
{
  fp32 INS_speed;
  fp32 INS_speed_set;
	fp32 INS_angle;
  fp32 INS_angle_set;
	fp32 INS_angle_err;
	
	fp32 ENC_angle;
	fp32 ENC_speed;
	fp32 ENC_angle_set;
	
  int16_t give_current;
	int16_t set_current;
	
	pid_type_def speed_pid;
	pid_type_def angle_pid;
	
	uint8_t control_mode;
	
} gimbal_motor_t;
typedef struct
{
	fp32 yaw;
	fp32 pitch;
	fp32 yaw_speed;
	fp32 pitch_speed;
	uint8_t pitch_protect;
	
  fp32 chassis_follow_gimbal_zero;
	fp32 angle_error;

	fp32 radar_angle_zero;
	
	fp32 counterattack_angle;
	uint8_t counterattack_flag;
	
	uint8_t follow_mode;
	uint8_t follow_change;
	fp32 radar_keep_angle;
	
} gimbal_control_t;

/*--base--end--*/
/*******/
/*******/
/*--extern--begin--*/
extern gimbal_motor_t   gimbal_LK[3];
extern gimbal_control_t gimbal_control;

/*--extern--end--*/
/*******/
/*******/
/*--function--begin--*/
extern void gimbal_vector_set(fp32 yaw_speed,fp32 pitch_speed,uint8_t follow_mode);
extern void Gimbal_Spin(fp32 Pitch_max,fp32 Pitch_min,fp32 Yaw_max,fp32 Yaw_min,fp32*speed_out,uint8_t mode);



/*--function--end*/




#endif
